package com.nimitz.web.controller.personnel;


import com.nimitz.common.core.controller.BaseController;
import com.nimitz.common.core.domain.AjaxResult;
import com.nimitz.personnel.domain.PersonnelFactory;
import com.nimitz.personnel.service.PersonnelFactoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/smart/personnel")
public class PersonnelController extends BaseController {

    @Autowired
    private PersonnelFactoryService personnelFactoryService;

    @GetMapping("/provinces")
    public List<PersonnelFactory> getProvinces() {
        return personnelFactoryService.getProvinces();
    }

    @GetMapping("/cities/{id}")
    public List<PersonnelFactory> getCities(@PathVariable Long id) {
        return personnelFactoryService.getCitiesByProvinceId(id);
    }

    @GetMapping("/districts/{id}")
    public List<PersonnelFactory> getDistricts(@PathVariable Long id) {
        return personnelFactoryService.getDistrictsByCityId(id);
    }
}
